<template>
	<view class="header-bg-image header-bg">
		<view style="height: 50rpx;"></view>
		<view class="padding-30">
			<view class="margin-30-0 flex-around" @click="$tools.navigateBack()">
				<u-icon name="arrow-left" color="#333333" size="20"></u-icon>
				<view class="fontSize-18 color-000 flex1 text-center">会员信息</view>
				<view style="width: 40rpx;"></view>
			</view>
			<view class="padding-30 user-info-bg flex-justAliCenter-column">
				<view class="flex-alignItems-center margin-bottom30" @click="$tools.navigateTo('/pages/mine/mine-list/user-name')">
					<view class="fontSize-15 margin-right20" style="color: #967C5E;">姓名</view>
					<view class="fontSize-15 color-704234 margin-right20">{{userinfo.nickname}}</view>
					<u-icon name="edit-pen" color="#6D2205" size="20"></u-icon>
				</view>
				<view class="flex-alignItems-center margin-bottom30"
				 @click="$tools.navigateTo('/pages/mine/mine-list/user-phone')">
					<view class="fontSize-15 margin-right20" style="color: #967C5E;">手机号</view>
					<view class="fontSize-15 color-704234 margin-right20">{{userinfo.mobile}}</view>
					<u-icon name="edit-pen" color="#6D2205" size="20"></u-icon>
				</view>
				<view class="flex-alignItems-center"
				 @click="$tools.navigateTo('/pages/mine/mine-list/address/address')">
					<view class="fontSize-15 margin-right20" style="color: #967C5E;flex-shrink: 0;">默认地址</view>
					<view class="fontSize-15 color-704234 margin-right20 text-ellipsis" v-if="address.id">{{address.area}}{{address.address}}</view>
					<view class="fontSize-15 color-704234 margin-right20" v-else>请添加默认地址</view>
					<u-icon name="edit-pen" color="#6D2205" size="20"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				userinfo:{},
				address:{}
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.address = uni.getStorageSync('address_default')
			this.getUserInfo()
		},
		methods:{
			// 获取个人信息
			async getUserInfo() {
				let res = await this.$http.post(this.$api.user_info, {}, {
					token: true
				})
				this.userinfo = res.data
			}
		}
	}
</script>

<style lang="scss" scoped>
	.user-info-bg{
		flex: 1;
		height: 370rpx;
		background: url('https://wudang.chunchuangkeji.cn/image/user-bg.png') no-repeat; 
		background-size: 100% 100%;
	}
</style>